import request from '@/utils/request';

// 分类列表
export const fetchCategoryList = () => {
  return request('/admin/category', {
    method: 'GET',
  });
};

// 添加分类
export const fetchAddCategory = (data: any) => {
  return request('/admin/category', {
    method: 'POST',
    data,
  });
};

// 修改分类

interface fetchUploadCategoryProps {
  name: string;
  pid?: string;
}
export const fetchUploadCategory = (
  id: number,
  data: fetchUploadCategoryProps,
) => {
  return request(`/admin/category/${id}`, {
    method: 'PUT',
    data,
  });
};
